#include <iostream>
#include <math.h>
#include <string.h>
#include <map>
using namespace std;

int INDX(int i, int j){
	return i*1500+j;
}

int dfs(map<int,int> data, int n, int m, int x, int y, int idx){
	int offset[3] = {-1,0,1};
	if(data[INDX(x,y)]==0 || data[INDX(x,y)]==idx) return 0;
	int sum = 0;	
	data[INDX(x,y)] = idx;
	sum++;
	
	for(int i=0; i<3; i++){
		for(int j=0; j<3; j++){
			if(i==1&&j==1) continue;
			int newX = x+offset[i];
			int newY = y+offset[j];
			if(newX>=0 && newX<n && newY>=0 && newY<m)
				sum += dfs(data, n, m, newX, newY, idx);
		}
	}
	return sum;
}

int main(){
	int n,m;
	cin>>n>>m;
//	char data[n][m];
	map<int, int> data;
	map<int, int> xz;
	
	// in
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			char l;
			cin>>l;
			data[INDX(i,j)] = l=='*'?-1:0;
		}
	}
	
	// main
	int idx = 1;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(data[INDX(i,j)]!=-1) continue;
			
			int num = dfs(data, n, m, i, j, idx);
			xz[num] = xz[num] + 1;
			idx++;
		}
	}

	// out
	int max=0;	
	for(map<int,int>::iterator it=xz.begin(); it!=xz.end(); it++){
		int s = it->first*it->second;
		if(s>max) max = s;
	}
	cout<<xz.size()<<" "<<max;
}
